//
//  CComEditView.h
//  HCHK_iphone
//
//  Created by yilong zhang on 12-1-5.
//  Copyright 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "CMainPageCtrl.h"
#import "CDisItemView.h"
#import "CDisCellView.h"
#import "CCommentary.h"
#import "CUser.h"

#define DIS_FONTSIZE    12

@class CPreItem;

//====================================================================================================================

@interface CellData : NSObject

@property (nonatomic, retain) CCommentary   *m_Com;
@property (nonatomic, assign) CGFloat       m_fHeight;

-(id)initWithCom:(CCommentary*)com Height:(CGFloat)height;

@end

//====================================================================================================================

@protocol WriteViewDelegate <NSObject>

@optional
-(void)DidWriteViewButtonClicked:(UIButton*)sender Object:(id)object;

@end

//====================================================================================================================

@interface CWriteView : UIView <UITextViewDelegate>

@property (nonatomic, assign) id<WriteViewDelegate>  delegate;

@property (nonatomic, assign) IBOutlet UIView        *m_BackView;
@property (nonatomic, assign) IBOutlet UILabel       *m_Title;
@property (nonatomic, assign) IBOutlet UITextView    *m_TextView;
@property (nonatomic, assign) IBOutlet UIImageView   *m_Icon;
@property (nonatomic, assign) IBOutlet UIView        *m_Shadow;
@property (nonatomic, assign) IBOutlet UIView        *m_Stars;
@property (nonatomic, assign) IBOutlet UIButton      *m_ComitBtn;
@property (nonatomic, assign) IBOutlet UIButton      *m_CancelBtn;

-(void)InitComWriteView;
-(void)SetLightStarNum:(int)num;
-(void)ResetStars;
-(IBAction)OnButtonDown:(UIButton*)sender;

@end 

//====================================================================================================================

@protocol ComEditDelegate <NSObject>

@optional
-(void)DidComEditClicked:(int)index Content:(NSString*)content;
-(void)DidPingJiaClicked:(int)index;
-(void)DidSameButtonClicked:(int)index Title:(NSString*)title;

@end

@interface CComEditView : UIView <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, ProductDelegate, WriteViewDelegate, OperationDelegate, GalleryDelegate>

@property (nonatomic, assign) id<ComEditDelegate>   delegate;

@property (nonatomic, assign) UIView            *m_TopBar;
@property (nonatomic, assign) UIView            *m_TopInfo;
@property (nonatomic, assign) UILabel           *m_PdtName;
@property (nonatomic, assign) UILabel           *m_ResName;
@property (nonatomic, assign) UILabel           *m_ResAddr;
@property (nonatomic, assign) UILabel           *m_PubName;
@property (nonatomic, assign) UILabel           *m_SumContent;
@property (nonatomic, assign) UIView            *m_StarsPanel;
@property (nonatomic, assign) UIView            *m_SharePanel;
@property (nonatomic, assign) UIButton          *m_Drawer;
@property (nonatomic, assign) UIImageView       *m_Local;
@property (nonatomic, assign) UILabel           *m_Distance;
@property (nonatomic, assign) UIButton          *m_AddCom;
@property (nonatomic, assign) UIScrollView      *m_Scroll;
@property (nonatomic, assign) UIImageView       *m_Image;
@property (nonatomic, assign) UIImageView       *m_Icon;
@property (nonatomic, assign) UITableView       *m_Table;
@property (nonatomic, assign) CGFloat           m_FontHeight;
@property (nonatomic, assign) CProduct          *m_Product;
@property (nonatomic, assign) NSMutableArray    *m_DisData;
@property (nonatomic, assign) UIView            *m_BtnPanel;
@property (nonatomic, assign) UIButton          *m_Share;
@property (nonatomic, assign) UIButton          *m_More;
@property (nonatomic, assign) UIButton          *m_Addr;
@property (nonatomic, assign) CWriteView        *m_Write;
@property (nonatomic, assign) CPreItem          *m_PreItem;

@property (nonatomic, assign) UIButton          *m_Pinglun;
@property (nonatomic, assign) UIButton          *m_ComFinishBtn;
@property (nonatomic, assign) UIButton          *m_SameName;
@property (nonatomic, assign) UIButton          *m_SameRes;
@property (nonatomic, assign) UIButton          *m_DelBtn;
@property (nonatomic, assign) UIButton          *m_NiceBtn;
@property (nonatomic, assign) UIButton          *m_wantBtn;

@property (nonatomic, assign) UIView            *m_SuvView;
@property (nonatomic, assign) CGalleryView      *m_SubImgs;

-(void)SetUpSharePanel;
-(void)OnShareBtnDown:(UIButton*)sender;
-(void)ShowShare;
-(void)HiddenShare;
-(void)ResetComEditView;
-(void)OnBackButtonDown:(UIButton*)sender;
-(void)OnPingLunButtonDown:(UIButton*)sender;
-(void)AddNewCommetry:(CCommentary*)com Index:(int)index;
-(void)AddNewCommenties:(NSArray*)coms;
-(void)CommentariesWorker:(id)object;
-(void)SetComEditViewInfo:(CProduct*)product Item:(CPreItem*)item;
-(void)SetComEditViewInfoEx:(CProduct*)product;
-(NSString*)GetDistance:(CProduct*)product Coordinate:(CLLocationCoordinate2D)coordinate;

//好吃，好看，想吃
- (void)OnPingJiaButtonDown:(UIButton*)sender;
- (void)CommitPingJia:(int)index;
- (void)OnFavoriteButtonDown:(UIButton*)sender;

//attentionpanel
-(void)OnAttenButtonDown:(UIButton*)sender;
-(void)OnAttentionSelected:(UIButton*)sender;
-(void)CommitPeopleRequest;
-(void)ReceivePeopleResponse:(NSDictionary*)data;
-(void)CommitFoodRequest;
-(void)ReceiveFoodResponse:(NSDictionary*)data;
-(void)CommitAddressRequest;
-(void)ReceiveAddressResponse:(NSDictionary*)data;

//stars
-(void)SetLightStars:(int)num;
-(void)RestStars;

-(void)OnDrawerDown:(UIButton*)sender;
-(void)ShowSubImgsPanel;
-(void)HiddenSubImgsPanel;

@end
